package com.hgyc.mom.wms.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hgyc.mom.wms.mapper.WmsStockInDetailMapper;
import com.hgyc.mom.wms.entity.WmsStockInDetail;
import com.hgyc.mom.wms.service.WmsStockInDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import com.hgyc.mom.common.exception.BizException;
import org.springframework.util.CollectionUtils;

/**
 * 入库单明细Service业务层实现
 *
 * @author fwj
 * @since 2025-10-08
 */
@Slf4j
@Service
public class WmsStockInDetailServiceImpl extends ServiceImpl<WmsStockInDetailMapper, WmsStockInDetail> implements WmsStockInDetailService {

    @Override
    public List<WmsStockInDetail> getByParentId(Long parentId) {
        LambdaQueryWrapper<WmsStockInDetail> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(WmsStockInDetail::getStockInId, parentId);
        return list(wrapper);
    }

    @Override
    public void deleteByParentId(Long parentId) {
        LambdaQueryWrapper<WmsStockInDetail> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(WmsStockInDetail::getStockInId, parentId);
        remove(wrapper);
    }

    @Override
    public void deleteBatchByParentIds(List<Long> parentIds) {
        LambdaQueryWrapper<WmsStockInDetail> wrapper = new LambdaQueryWrapper<>();
        wrapper.in(WmsStockInDetail::getStockInId, parentIds);
        remove(wrapper);
    }
}
